<?php
namespace Admin\Controller;
use Think\Controller;
use Common\Controller\AuthController;
use Think\Auth;

class IndexController extends AuthController {
	
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/
	
    public function index(){

    	if (empty($_SESSION['aid'])){
    		$this->redirect('Login/login');
    	}

    	$info = array(
  			'PCTYPE'=>PHP_OS,
  			'RUNTYPE'=>$_SERVER["SERVER_SOFTWARE"],
  			'ONLOAD'=>ini_get('upload_max_filesize'),
  			'ThinkPHPTYE'=>THINK_VERSION,
    	);

//本月订单数
$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));
$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'));
 $map_month['audit_time'] = array(array('egt',$beginThismonth),array('elt',$endThismonth),'AND');
$map_month_nums=M('order')->where('paystatus=1')->where($map_month)->sum('order_num');
$this->assign('map_month_nums',$map_month_nums);
//本年订单数
$d0 = strtotime(date("Y",time())."-1"."-1"); //本年开始
$d1 = strtotime(date("Y",time())."-12"."-31"); //本年结束
 $map_year['audit_time'] = array(array('egt',$d0),array('elt',$d1),'AND');
$map_year_nums=M('order')->where('paystatus=1')->where($map_year)->sum('order_num');
$this->assign('map_year_nums',$map_year_nums);

//注册人数当天

$t = time();
$start = mktime(0,0,0,date("m",$t),date("d",$t),date("Y",$t));
$end = mktime(23,59,59,date("m",$t),date("d",$t),date("Y",$t));
 $res_day['ctime'] = array(array('egt',$start),array('elt',$end),'AND');
$res_day_nums=M('user')->where('status>=1')->where($res_day)->count();
$this->assign('res_day_nums',$res_day_nums);
    	$this->assign('info',$info);
	    $this->display();
       
    }

}